<%
response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","no-cache");
response.setDateHeader("Expires",0);
%>
<%@page contentType="text/html" pageEncoding="iso-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>

<%@ page language="java" import='java.util.ArrayList'%>
<%@ page language="java" import='java.util.List'%>
<%@ page language="java" import='pe.gov.mtc.dgac.licencias.bean.*'%>
<%@ page language="java" import='pe.gov.mtc.dgac.licencias.util.*'%>
<%@ page language="java" import='java.text.DecimalFormat'%>

<% String busqueda=request.getParameter("busqueda");
   boolean bus=false;
   if(busqueda!=null)bus=true; 
%>
<html><head><title>LISTADO DE DATOS</title>
<base target="_self"> 
<meta http-equiv="Content-Type" content="text/html; charset=unicode">
<link href="/WebLicenciasNew/css/espacio.css" type=text/css rel=stylesheet>
<link href="/WebLicenciasNew/css/calendar-system.css" type=text/css rel=stylesheet>
<script language="javascript" src="/WebLicenciasNew/js/calendar.js"></script>
<script language="javascript" type="text/javascript" src="/WebLicenciasNew/js/js.Farmacia.Function.js"></script>
<script language="javascript" src="/WebLicenciasNew/js/calendar-es.js"></script>
<script language="javascript" src="/WebLicenciasNew/js/utils.js"></script>

<script language="javascript">
//setResizableElements('res');
    function validarMenu(menu){
        if(menu=="1"){
		   document.getElementById('idTabla').style.display="inline"; 
        }
    }
   function Buscar(pagina){
        //document.forms[0].action="/processCliente?dispatch=buscarCliente";
        document.forms[0].page.value=pagina;
        document.forms[0].submit();
                
    }
    function Limpiar(){
        
        document.frmBuscar.txtfecotor.value="";
                
    }
    
    function ValidarNum(){
        var texto=document.frmBuscar.txtnumlic.value;
        if (isNaN(texto)) {
          document.frmBuscar.txtnumlic.value=texto.substring(1,texto.length-1);  
        }
                
    }
    function volver(CodCli,Nom,NumDoc,Email){
      var result=new Array(CodCli,Nom,NumDoc,Email);            
      window.returnValue=result;  
      window.close();  
    }
    function ExportarXLS(){
       document.forms[0].action="/WebLicenciasNew/processCliente.do?dispatch=buscarClienteXLS";
       document.forms[0].submit(); 
    }
    function ver(codcli){
       document.forms[0].action="/WebLicenciasNew/processCliente.do?dispatch=verCliente&cliente="+codcli;
       document.forms[0].submit(); 
    }
</script>

<body>
<table width="100%" align="center" bgcolor="#fffdd6" border="0">
  <!--form action="/WebLicenciasNew/processCliente?dispatch=buscarCliente" id="frmBuscar" name="frmBuscar"-->
 <html:form styleId="frmBuscar" action="/processCliente?dispatch=buscarCliente" method="post">
   <input type="hidden" name="metodo" value="buscar">  
   <input type="hidden" name="page" value="">  
   <%if(bus){%>
   <input type="hidden" name="busqueda" value="1">    
   <%}%>
  <tbody>
  <tr>
    <td></td></tr>
  <tr>
    <td></td></tr>
  <tr>
    <td></td></tr>
  <tr>
    <td>
      <div class="Titulo1B" align="center">LISTADO DE CLIENTES</div></td></tr>
  <tr>
    <td>
      <table width="98%" align="left">
        <tbody>
        <tr>
          <td>
            <fieldset class="TablaBorde"><legend class="TituloAzulClaro">Filtrado 
            por </legend>
            <table width="500" align="center">
              <tbody>
              <tr>
                <td class="TituloAzulClaro" align="right">Codigo </td>
                <td><input class="Campo" maxlength="20" name="cliente"></td>
                <td class="TituloAzulClaro" align="right"></td>
                <td></td></tr>
              <tr>
                <td class="TituloAzulClaro" align="right">Ap. Paterno</td>
                <td><input class="Campo" maxlength="20" name="txtapepat"></td>
                <td class="TituloAzulClaro" align="right">Ap. Materno</td>
                <td><input class="Campo" maxlength="20" name="txtapemat"></td></tr>  
              <tr>
                <td class="TituloAzulClaro" align="right">Nombres </td>
                <td><input class="Campo" maxlength="20" name="txtnombres"></td>
                <td class="TituloAzulClaro" align="right">No Documento</td>
                <td><input class="Campo" maxlength="20" 
              name="txtnumdoc"></td></tr>
              </tbody></table></fieldset></td></tr></tbody></table></td></tr>
  <tr>
    <td class="TextoPortal" colspan="2">
      <div align="center"><input class="boton" onclick="Buscar(0);" type="button" value="Buscar" name="Submit22"> 
      <%if(!bus){%>
      <input class="boton" onclick="location.href='NClienteTabForm.jsp'" type="button" value="Agregar" name="Submit22"> 
      <%}%>
      </div></td></tr>
  <tr>
    <td colspan="2">
      <display:table  name="listClientes" class="consultanormal" pagesize="10"
       defaultsort="2" defaultorder="ascending" sort="list" export="true" id="row" >
        <display:column>
            <%if(!bus){%>
              <div align="center"><img title="Modificar" style="CURSOR: hand" 
              onclick="ver(${row.codCliente})" height=15 
              src="/WebLicenciasNew/imagenes/boton_modificar.gif" width=15 align=middle 
              border=0> </div>
            <%}else{%>
             <div align="center"><img title="Modificar" style="CURSOR: hand" 
              onclick="volver('${row.codCliente}','${row.nombreCompleto}','${row.tipoIdDoc.descripcion}-${row.numIdDoc}','${row.email}')" height=15 
              src="/WebLicenciasNew/imagenes/boton_buscar.gif" width=15 align=middle 
              border=0> </div>
           <%}%>   
        </display:column>
         <display:column title="Codigo" property="codCliente"  sortable="false" headerClass="sortable" class="TextoTabla8"  />
         <display:column title="Nombre" property="nombreCompleto"  sortable="false" headerClass="sortable" class="TextoTabla8" />
         <display:column title="Tipo Doc" property="tipoIdDoc.descripcion"  sortable="false" headerClass="sortable"  class="TextoTabla8"/>         
         <display:column title="No Documento" property="numIdDoc"  sortable="false" headerClass="sortable" class="TextoTabla8" />
         <display:column title="Fec Nacimiento" property="sfecha_nac"  sortable="false" headerClass="sortable" class="TextoTabla8" />
         <display:column title="Nacionalidad" property="nacionalidad"  sortable="false" headerClass="sortable" class="TextoTabla8" />
    </display:table>   
    </td>
  </tr>   
  </tbody>
  </table>

</html:form>
<script language="javascript">
highlightTableRows('row');
</script>
</body></html>
